﻿using SIE.SCADA.Common;
using SIE.SCADA.Common.Log;
using SIE.SCADA.Common.Repository;
using SIE.SCADA.StationDemo.SerialCommunicat;
using System;
using System.Collections.Generic;
using System.Text;

namespace SIE.SCADA.StationDemo
{
    class StationDemoServer : Runner
    {
        StationController stationController;


        public override string ClassType
        {
            get => typeof(StationDemoServer).FullName + "," + typeof(StationDemoServer).Assembly.ManifestModule.Name;
            set { }
        }

        public override bool Exit()
        {
            return true;
        }

        public override bool Init()
        {
            stationController = StationController.CreateInstance();
            var command = new StationDemoCommand();
            Command = command;
            return true;
        }

        public override bool Load(string fileName)
        {
            FileName = fileName;
            Repository = new JsonRepository(FileName);
            return true;
        }

        public override bool SaveAs(string fileName)
        {
            return true;
        }

        public override bool Start()
        {
            Logger.Info("StationDemo Start!");

            return true;
        }

        public override bool Stop()
        {
            stationController?.Stop();
            return true;
        }
    }
}
